﻿<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" default-lazy="true" namespace="Cms.Domain" assembly="Cms.Domain">
  <class name="DetailTemplate" table="cmsDetailTemplate">
    <cache usage="read-write" />
    <id name="ID" unsaved-value="0" column="ID" type="System.Int32">
      <generator class="identity" />
    </id>
    <property name="Name" column="TemplateName" not-null="true" type="System.String" />
    <property name="Description" column="TemplateDescription" not-null="false" type="System.String" />
    <many-to-one name="Site" column="SiteID" not-null="true" />
    <many-to-one not-null="true" cascade="all" name="SourceCode" column="SourceCodeID" />
    <bag name="Content" inverse="true" cascade="all-delete-orphan" table="cmsDetailTemplateContent">
      <cache usage="read-write" />
      <key column="DetailTemplateID" />
      <one-to-many class="DetailTemplateContentLink" />
    </bag>
    <bag name="Pages" table="cmsPage" cascade="save-update">
      <cache usage="read-write" />
      <key column="DetailTemplateID" />
      <one-to-many class="Page" />
    </bag>
    <map name="ContentSets" table="cmsDetailTemplateContentSet" inverse="true" cascade="all-delete-orphan">
      <cache usage="read-write" />
      <key column="DetailTemplateID" />
      <index column="LocaleID" type="System.Int32" />
      <one-to-many class="DetailTemplateContentSet" />
    </map>
    <bag name="Areas" table="cmsDetailTemplateArea">
      <cache usage="read-write" />
      <key column="DetailTemplateID" />
      <element column="AreaID" type="System.String" />
    </bag>
    <bag name="PageAreas" table="cmsDetailTemplatePageArea">
      <cache usage="read-write" />
      <key column="DetailTemplateID" />
      <element column="AreaID" type="System.String" />
    </bag>
    <many-to-one name="DefaultMasterTemplate" column="DefaultMasterTemplateID" not-null="false" />
  </class>
</hibernate-mapping>